home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Snippets / Development Tools & Languages / DTSCPlusLibrary / Sources / Timer.h < prev    next >
Encoding:
Text File  |  1993-01-14  |  2.0 KB  |  70 lines  |  [TEXT/MPS ]

  1. /* _________________________________________________________________________________________________________ //
  2.   Copyright © 1992-93 Apple Computer, Inc. All rights reserved.
  3.   Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
  4.   Programmer: Kent Sandvik
  5.   Date: 12/14/92
  6.   Revision comments are at the end of this file.
  7.   ---
  8.   TTimer is a simple timing class that could provide both 10 lap time values as well as
  9.   final values.
  10.   TTimer.h contains the TTimer class definition. 
  11.   _________________________________________________________________________________________________________ */
  12.  
  13. // Declare label for this header file
  14. #ifndef _TIMER_
  15. #define _TIMER_
  16.  
  17.  
  18. #ifndef _DTSCPLUSLIBRARY_
  19. #include "DTSCPlusLibrary.h"
  20. #endif
  21.  
  22. #ifndef __EVENTS__
  23. #include <Events.h>
  24. #endif
  25.  
  26.  
  27. // _________________________________________________________________________________________________________ //
  28. //    TTimer Class Interface.
  29.  
  30. class TTimer
  31. // TTimer is a simple timer class that could be used for taking time stamps and lap count timer
  32. // values.
  33. {
  34. public:
  35.     // CONSTRUCTORS AND DESTRUCTORS
  36.     TTimer();
  37.     virtual~ TTimer();
  38.  
  39.     // MAIN INTERFACE
  40.     virtual void Start();                        // start timer
  41.     virtual void Stop();                        // stop timer
  42.     virtual void Reset();                        // reset timer
  43.  
  44.     virtual void SetLap(short index);            // set lap time [0-10]
  45.     virtual long GetLap();                        // returns temp lap time
  46.     virtual long GetLap(short index);            // return specific lap time [0-10]
  47.  
  48.     virtual long GetTicks();                    // return tick count
  49.     virtual float GetSeconds();                    // return seconds with two decimal points
  50.  
  51.     // FIELDS
  52. protected:
  53.     long fStartTick;                            // start tick value
  54.     long fStopTick;                                // stop tick value
  55.     long fLapIndex[11];                            // array of 10 lap time values
  56. };
  57.  
  58.  
  59. #endif
  60.  
  61.  
  62. // _________________________________________________________________________________________________________ //
  63.  
  64.  
  65. /*    Change History (most recent last):
  66.   No        Init.    Date        Comment
  67.   1            khs        12/14/92    New file
  68.   2            khs        1/3/93        Cleanup
  69. */
  70.